<script setup>
import { inject, ref } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";

onLoad((e) => {
  status.value = e.status;
});
const status = ref();

// 返回首页
const goGoorder = () => {
  // uni.navigateBack()
  uni.reLaunch({ url: "/pages/index/index" });
};

// 查看订单
const goOrder = () => {
  uni.navigateTo({
    url: "/pages/order/orderlist/index?status=-2",
  });
};

// 返回
const goback = () => {
  let pages = getCurrentPages();

  // 获取页面栈的长度，即页面跳转层级
  let level = pages.length;

  if (level > 1) {
    uni.navigateBack();
  } else {
    uni.switchTab({
      url: "/pages/my/index",
    });
  }
};
</script>
<template>
  <view class="paycontent">
    <view class="pay-hx" v-if="status == 200"> </view>
    <view class="pay-hx pay-err" v-else> </view>
    <view class="pay-res" v-if="status == 200">
      <view class="pay-res-img">
        <image src="@/pages/upgrade/static/icon_successful.png" mode=""></image>
      </view>
      <view class="pay-res-name"> 提交成功 </view>
      <view class="pay-res-dec"> 已提交至财务，等待财务审核后升级 </view>
      <view class="pay-res-k">
        <view class="pay-res-see" @click="goOrder"> 查看订单 </view>
        <view class="pay-res-bt" @click="goGoorder"> 返回首页 </view>
      </view>
    </view>

    <view class="pay-res" v-else>
      <view class="pay-res-img">
        <image src="@/pages/upgrade/static/icon_error.png" mode=""></image>
      </view>
      <view class="pay-res-name"> 提交失败 </view>
      <view class="pay-res-dec"> 提交失败,请重新提交 </view>
      <view class="pay-res-k">
        <view class="pay-res-see refresh-pay" @click="goback"> 返回 </view>
      </view>
    </view>
  </view>
</template>

<style lang="scss" scoped>
@import "index.scss";
</style>
